The robot is moving in an environment of which it does not have a global knowledge. It has its own coordinate system where it itself is the origin. However, the position of the robot in the environment is known. To elect a goal point or avoid obstacles, it is necessary to convert point coordinates relative to the environment in  robot coordinate system. A transformation must be applied to the point. That transformation consists of a translation and a reverse rotation.\\
        
        The translation is given by the following system :
        \begin{displaymath}
         \left\lbrace
         \begin{matrix}
                  x' = x - x_c\\ 
                  y' = y - y_c
            \end{matrix}\right.
        \end{displaymath}
        with $x'$, $y'$ new coordinates, $x$, $y$ coordinates relative to the environment and $x_c$, $y_c$ the coordinates of the robot in its environment.\\
        
        As the robot can have rotated in its environment, a reverse rotation must be applied to the coordinates previously computed. The rotation angle of  the robot in relation to the world is given by a quaternion (which is retrieved at the same time as its position). As it can be seen in section \ref{quaterion}, in our case, only the angle around the Z-axis is needed. To convert the quaternion to an Euler angle around the Z-axis, the following formula is used : 
        \begin{displaymath}
            \theta = atan2(2(q_0q_3 + q_1q_2), 1 - 2(q_2^2 + q_3^2))
        \end{displaymath}
        
        Reverse rotation of angle $\theta$ corresponds to the following matrix :
        
        \begin{displaymath}
           R^{-1} = 
              \left( 
            \begin{matrix}
                cos(\theta) & sin(\theta)\\
                -sin(\theta) & cos(\theta)
            \end{matrix}
            \right)
        \end{displaymath}
        
        To get the coordinate of a point in the robot coordinate system, it is sufficient to apply this rotation to the previously computed coordinates $x'$ and $y'$. Finally, the new coordinates will be : 
        \begin{displaymath}
            \left\lbrace\begin{matrix}
                  x_R = (x - x_c) cos(\theta) + (y - y_c) sin(\theta)\\ 
                  y_R = -(x - x_c) sin(\theta) + (y - y_c) cos(\theta)
            \end{matrix}\right.
        \end{displaymath}